package net.stratusprogramming.school.Game.Framework.Scene;

import net.stratusprogramming.school.Game.Framework.System.SaveMgr;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Rectangle;

/**
 * Actor class to be extended by all players, NPCs and the like
 * 
 * @author Lienau
 */
public abstract class Actor {
	
	/**
	 * Protected fields will be used a bunch each frame,
	 * I'm forgoing encapsulation for speed. Anything else
	 * will be private with gets/sets.
	 */
	
	private Group parent;
	protected float x;
	protected float y;
	protected float width;
	protected float height;
	protected Rectangle boundingBox;
	
	public abstract void update(int delta);
	public abstract void render(Graphics g);		
	public abstract void save(SaveMgr saveMgr);
	public abstract void load(SaveMgr saveMgr);
	
	protected void initBoundingBox() {
		boundingBox = new Rectangle(x, y, width, height);
	}
	
	protected void updateBoundingBox() {
		boundingBox.setX(x);
		boundingBox.setY(y);
	}
	
	/* Getters and Setters */
	
	/**
	 * @return the width
	 */
	public float getWidth() {
		return width;
	}
	
	/**
	 * @param width the width to set
	 */
	public void setWidth(float width) {
		this.width = width;
		if(boundingBox != null) boundingBox.setWidth(width);
	}
	
	/**
	 * @return the height
	 */
	public float getHeight() {
		return height;
	}
	
	/**
	 * @param height the height to set
	 */
	public void setHeight(float height) {
		this.height = height;
		if(boundingBox != null) boundingBox.setHeight(height);
	}
	
	/**
	 * Returns the float Y
	 * @return
	 */
	public float getY() {
		return y;
	}
	
	/**
	 * @param y
	 */
	public void setY(float y) {
		this.y = y;
	}
	
	/**
	 * Getter for the 
	 * @return
	 */
	public float getX() {
		return x;
	}
	
	/**
	 * Set the this.x to x
	 * @param x
	 */
	public void setX(float x) {
		this.x = x;
	}
	
	/**
	 * Getter for the parent
	 * @return
	 */
	public Group getParent() {
		return parent;
	}
	
	/**
	 * Set this.parent to parent
	 * @param parent
	 */
	public void setParent(Group parent) {
		this.parent = parent;
	}
	
}
